home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Database How-To / Visual Basic 4 Database - How-to (The Waite Group)(1995).iso / editing.cl_ / editing.cl
Text File  |  1995-07-20  |  2KB  |  78 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = 0   'False
  4. END
  5. Attribute VB_Name = "EditPublishers"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. 'Declare the variables that will hold the class's Properties
  11. Public FilePathName As String
  12. Private ConnectString As String
  13. Public TableName As String
  14.  
  15. 'Data access objects for getting information about the Recordset
  16. Private db As DATABASE
  17. Private rs As Recordset
  18.  
  19.  
  20.  
  21. Public Property Get Connection() As String
  22.     Connection = ConnectString
  23. End Property
  24.  
  25.  
  26.  
  27.  
  28. Public Property Get Height()
  29.     Height = frmEdit.Height
  30. End Property
  31.  
  32. Public Sub Move(formLeft As Integer, formTop As Integer)
  33.     'When the form is a child of another window, all
  34.     'measurements are relative to that parent window,
  35.     'so all we need to do is set the position
  36.     frmEdit.Move formLeft, formTop
  37. End Sub
  38.  
  39. Public Property Get NumRecords() As Integer
  40.     rs.MoveLast
  41.     NumRecords = rs.RecordCount
  42.     rs.MoveFirst
  43. End Property
  44.  
  45. Public Sub SetOnForm(parentHwnd As Variant)
  46.     Dim prevParent As Variant
  47.     
  48.     prevParent = SetParent(frmEdit.hWnd, parentHwnd)
  49.     frmEdit.Show
  50. End Sub
  51.  
  52. Public Property Get Width()
  53.     Width = frmEdit.Width
  54. End Property
  55.  
  56.  
  57. Private Sub Class_Initialize()
  58.     'Make a connection to the database for accessing
  59.     'other parameters
  60.     frmEdit.Hide
  61.     
  62.     Set db = OpenDatabase(frmEdit.dataTitles.DatabaseName)
  63.     Set rs = db.OpenRecordset(frmEdit.dataTitles.RecordSource, dbOpenSnapshot)
  64.     
  65.     FilePathName = frmEdit.dataTitles.DatabaseName
  66.     ConnectString = db.Connect
  67.     TableName = frmEdit.dataTitles.RecordSource
  68. End Sub
  69.  
  70.  
  71.  
  72. Private Sub Class_Terminate()
  73.     Set db = Nothing
  74.     Set rs = Nothing
  75. End Sub
  76.  
  77.  
  78.